package main

import (
	_ "denglibin.io/common/log"
	"github.com/sirupsen/logrus"
	"github.com/smallnest/rpcx/server"
	"go.web.demo.com/service/service"
)

//注册服务
func registerService(s *server.Server) {
	logrus.Info("注册服务::UserService")
	err := s.RegisterName("UserService", new(service.UserService), "")
	if err != nil {
		panic(err)
	}
	logrus.Info("注册服务::ActivityService")
	err = s.RegisterName("ActivityService", new(service.ActivityService), "")
	if err != nil {
		panic(err)
	}
	logrus.Info("注册服务::PatientService")
	err = s.RegisterName("PatientService", new(service.PatientService), "")
	if err != nil {
		panic(err)
	}

}

func main() {
	logrus.Info("创建服务器")
	s := server.NewServer()
	registerService(s)
	logrus.Info("启动服务,端口:8972")
	err := s.Serve("tcp", ":8972")
	if err != nil {
		panic(err)
	}
}
